
import type { Theme } from 'vitepress'
import 'normalize.css'
import 'uno.css'
import 'element-plus/dist/index.css'

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import VPApp, { NotFound, globals } from '../vitepress'

const define = <T>(value: T): T => value
export default define<Theme>({
  NotFound: NotFound,
  Layout: VPApp,
  enhanceApp: ({ app }) => {
    app.use(ElementPlus)
    app.use(ElementPlus, {
      locale: zhCn,
    })
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
    globals.forEach(([name, Comp]) => {
      app.component(name, Comp)
    })
  },
})
